import java.util.Scanner;

//单词搜索 考虑四个维度
public class test2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();//要输入的词数
        String[] str = new String[n];
        String word = scanner.next();
        boolean result = exist(str,word);
        System.out.println(result);
    }
    public static boolean exist (String[] board, String word) {
        boolean flag = false;//找到了才返回true
        char[][] chars = new char[board.length][board[0].length()];
        for (int i = 0; i < board.length ; i++) {
            chars[i] = board[i].toCharArray();//转换为字符
        }
        char[] words = word.toCharArray();
        for (int i = 0; i < board.length ; i++) {
            for (int j = 0; j < board[0].length(); j++) {
                if(i>= board.length||j>=board[0].length()){
                    return flag;
                }
                if(words.length-1==0){
                    flag=true;
                    return flag;
                }
                /*if(getResult(chars,words,i,j,0)){
                    flag = true;
                    return flag;
                }*/
            }
        }
        return flag;
    }
   /* public boolean getResult(char[][] chars,char[] words,int i,int j,int k){
        boolean res =
    }*/
}
